package com.example.spring_boot_service.excepetion;

import com.example.spring_boot_service.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalException {
    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public Result ServiceException(ServiceException exception){
        return Result.error(exception.getMessage(),"500");
    }
}
